import { TABCHANGE } from "../../actionType"
const defaultState = {
    tabs:[
        {tip:"all",title:"全部",},
        {tip:"obligation",title:"待消费"},
        {tip:"noEvaluation",title:"待评价"},
        {tip:"refund",title:"退款"}],
    orderList:[
            {orderId:1,shop:"三顾冒菜",imgUrl:require("../../../assets/images/sangumaocai.jpg"),
            discounts:["30减5","50减8","80减10"],
            goods:[
                {id:"11",name:"女神单人套餐女神单人套餐",price:19.9,originPrice:35,imgUrl:require("../../../assets/images/nvshentaocan.jpg")},
                {id:"12",name:"蜂蜜柠檬冷饮",price:6.99,originPrice:12,imgUrl:require("../../../assets/images/ningmengshui.jpg")}
                ],
            orderStatus:"已送达"
            },
            {orderId:2,shop:"三顾冒菜",imgUrl:require("../../../assets/images/sangumaocai.jpg"),
            discounts:["30减5","50减8","80减10"],
            goods:[
                {id:"21",name:"女神单人套餐女神单人套餐",price:19.9,originPrice:35,imgUrl:require("../../../assets/images/nvshentaocan.jpg")},
                {id:"22",name:"蜂蜜柠檬冷饮",price:6.99,originPrice:12,imgUrl:require("../../../assets/images/ningmengshui.jpg")}
                ],
            orderStatus:"配送中"
            },
            {orderId:3,shop:"三顾冒菜",imgUrl:require("../../../assets/images/sangumaocai.jpg"),
            discounts:["30减5","50减8","80减10"],
            goods:[
                {id:"31",name:"女神单人套餐女神单人套餐",price:19.9,originPrice:35,imgUrl:require("../../../assets/images/nvshentaocan.jpg")},
                {id:"32",name:"蜂蜜柠檬冷饮",price:6.99,originPrice:12,imgUrl:require("../../../assets/images/ningmengshui.jpg")}
                ],
            orderStatus:"配送中"
            },
            {orderId:4,shop:"三顾冒菜",imgUrl:require("../../../assets/images/sangumaocai.jpg"),
            discounts:["30减5","50减8","80减10"],
            goods:[
                {id:"41",name:"女神单人套餐女神单人套餐",price:19.9,originPrice:35,imgUrl:require("../../../assets/images/nvshentaocan.jpg")},
                {id:"42",name:"蜂蜜柠檬冷饮",price:6.99,originPrice:12,imgUrl:require("../../../assets/images/ningmengshui.jpg")}
                ],
            orderStatus:"待付款"
            }
        ],
        tabIndex:0,
}
export default function(state=defaultState,action){
    let newState = JSON.parse(JSON.stringify(state))
    switch (action.type){
        case TABCHANGE:
            let item = JSON.stringify(action.payload.item);
            let arr = newState.tabs.map(v=>{
                return JSON.stringify(v)
            })
            newState.tabIndex = arr.indexOf(item);
        break;
        default:
            // console.log(action)
            break;
    }
    return newState;
}